﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SY_Library
{
    public static class Lists
    {
        /// <summary>
        /// 创建随机列表
        /// </summary>
        /// <param name="count">列表长度</param>
        /// <returns>创建的列表</returns>
        public static List<int> CreateRandomList(int count)
        {
            var list = new List<int>(count);
            for (int i = 0; i < count; i++)
                list.Add(i);
            var list_Random = new List<int>(count);
            while (list.Count > 0)
            {
                if (list.Count <= 0)
                    break;
                var index = new Random().Next(0, list.Count);
                list_Random.Add(list[index]);
                list.RemoveAt(index);
            }
            return list_Random;
        }
    }
}
